export const tableColumn = ctx => {
  return [
    {
      prop: 'productCode',
      label: '产品编码'
    },
    {
      prop: 'childCategoryName',
      label: '产品类目'
    },
    {
      prop: 'name',
      label: '产品名称'
    },
    {
      prop: 'specification',
      label: '规格'
    },
    {
      prop: 'unit',
      label: '单位'
    },
    {
      prop: 'apartmentListName',
      label: '可售部门'
    },
    {
      prop: 'costPrice',
      label: '成本价'
    },
    {
      prop: 'minSalePrice',
      label: '最低销售单价'
    },
    {
      prop: 'deliveryMoney',
      label: '运费'
    },
    {
      label: '操作',
      fixed: 'right',
      minWidth: '240px',
      render: (h, row) => {
        const copy = (
          <zm-button type="text" onClick={() => ctx.operation('copy', row)}>
            复制
          </zm-button>
        )
        const edit = (
          <zm-button
            type="text"
            disabled={+row.isCanEdit === 0}
            onClick={() => ctx.operation('edit', row)}
          >
            编辑
          </zm-button>
        )
        const detail = (
          <zm-button type="text" onClick={() => ctx.operation('detail', row)}>
            详情
          </zm-button>
        )
        const setSale = (
          <zm-button
            type="text"
            disabled={+row.status === 1}
            onClick={() => ctx.operation('setSale', row)}
          >
            {+row.status === 1 ? '已设为可售' : '设为可售'}
          </zm-button>
        )
        const del = (
          <zm-button
            type="text"
            disabled={+row.isCanDel === 0}
            onClick={() => ctx.operation('del', row)}
          >
            删除
          </zm-button>
        )

        return [copy, edit, detail, setSale, del]
      }
    }
  ]
}
